package io.xccit.common.exception;

import io.xccit.common.enums.ResultCodeEnum;
import lombok.Data;
import lombok.ToString;

/**
 * @author CH_ywx
 * @date 2023-06-23
 * @description 自定义异常
 */
@Data
@ToString
public class AuthCustomException extends RuntimeException{

    private Integer code;
    private String message;

    /**
     * 接收常量类型
     * @param code 状态码
     * @param message 信息
     */
    public AuthCustomException(Integer code,String message){
        super(message);
        this.code = code;
        this.message = message;
    }

    /**
     * 接收枚举类型
     * @param resultCodeEnum
     */
    public AuthCustomException(ResultCodeEnum resultCodeEnum){
        super(resultCodeEnum.getMessage());
        this.message = resultCodeEnum.getMessage();;
        this.code = resultCodeEnum.getCode();
    }
}
